/*
 * AccountDetails.h
 *
 *  Created on: 28.05.2009
 *      Author: h3llfire
 */

#ifndef ACCOUNTDETAILS_H_
#define ACCOUNTDETAILS_H_

#include <wx/wx.h>
#include "../../core/Account.h"
#include "../../core/events/SelfChangedEvent.h"
#include "../../core/events/AvatarChangedEvent.h"
#include "../../core/events/StatusEvent.h"
#include "../../core/events/AccountEvent.h"
#include "../StdUserInterfaceModule/ImppBitmapButton.h"

namespace Impp {

class AccountIcon{
public:
	Account* account;
	ImppBitmapButton* statusIcon;

	AccountIcon(Account* account, ImppBitmapButton* statusIcon);

};


class AccountDetails : public wxPanel{
private:
	wxStaticText* screenName;
	wxStaticBitmap* ownAvatar;
	wxStaticText* statusMsg;
	std::vector<AccountIcon*> icons;
	int lastIconId;
	Account* curDisplayedAccount;
	wxBoxSizer* statusIconSizer ;


	enum{
		ID_STATUS_ONLINE  = wxID_HIGHEST+20,
		ID_STATUS_FREE4CHAT,
		ID_STATUS_AWAY,
		ID_STATUS_OCCUPIED,
		ID_STATUS_DND,
		ID_STATUS_NA,
		ID_STATUS_INVISIBLE,
		ID_STATUS_VISIBLE,
		ID_STATUS_OFFLINE,

		ACCOUNT_DETAILS_ID_STATUS_ICON

	};

public:
	AccountDetails(wxWindow* parent);
	virtual ~AccountDetails();

	void recreateStatusIcons();

	void onStatusMouseDown(wxMouseEvent& event);
	void onStatusMouseOver(wxMouseEvent& event);
	void onStatusMessage(wxCommandEvent& event);
	void onAvatarMouseDown(wxMouseEvent& event);

	void updateStatusMessageLabel(Buddy* self);
	void updateAvatarBitmap(Buddy* self);
	void updateNameLabel(Buddy* self);

	void onSelfChanged(SelfChangedEvent & event);
	void onOwnAvatarChanged(AvatarChangedEvent & event);
	void onStatusSelected(wxCommandEvent & event);
	void onExtendedStatusSelected(wxCommandEvent & event);
	void onOwnStatusChanged(StatusEvent & event);
	void onAccountEvent(AccountEvent & event);

private:
    DECLARE_EVENT_TABLE()
};

inline AccountIcon::AccountIcon(Account* account, ImppBitmapButton* statusIcon) :
	account(account), statusIcon(statusIcon){};

}

#endif /* ACCOUNTDETAILS_H_ */
